import numpy as np
import math
import matplotlib.pyplot as plt

def LLR(Fz, Pz, Ft, Pt):
    #print Fz, Pz, Ft, Pt, Fz / Pz, math.log(Fz / Pz) 
    return Fz * math.log(Fz / Pz) + (Ft - Fz) * math.log((Ft - Fz) / (Pt - Pz))
    
#--------------------------------------------------------------------------
#MAIN

if __name__ == "__main__":
    print '====================================================' 
    
    Pt = 261568463.0
    Pz = Pt / 142
    Ft = Pt / 56
    #print len(range(int(Pz/800), int(Ft), 100))
    LLRlist = np.array([])

    for tempFz in range(int(Pz/800), int(Ft), 100):
        LLRlist = np.append(LLRlist, [tempFz, LLR(tempFz, Pz, Ft, Pt)])
        #np.append(LLRlist, LLR(tempFz, Pz, Ft, Pt))
        #print tempFz, LLR(tempFz, Pz, Ft, Pt)

    #print LLRlist
    LLRlist.shape = (-1, 2)

    print LLRlist

    plt.plot(LLRlist[:,0], LLRlist[:,1], 'g', linewidth=1.5)
    plt.scatter(LLRlist[:,0], LLRlist[:,1], color ='r')
    plt.show()